package com.check.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;

import com.check.dao.AgencyDao;
import com.check.dao.PersonDao;
import com.check.dao.PersonTempDao;
import com.check.dao.WorkRoleDao;
import com.check.pojo.Opr;
import com.check.pojo.OprTemp;
import com.check.pojo.Org;
import com.check.pojo.PageObject;
import com.check.pojo.WorkRole;
import com.check.service.AgencyService;
import com.check.service.PersonService;
import com.check.service.PersonTempService;
import com.check.service.WorkRoleService;
import com.check.util.StringUtil;

@Service("personTempService")
public class PersonTempServiceImpl  implements PersonTempService{

	@Autowired
	@Qualifier("agencyDao")
	private AgencyDao agencyDao;
	
	@Autowired
	@Qualifier("personTempDao")
	private PersonTempDao personTempDao;

	public List<OprTemp> findAllOprTemp(String oprId) {
		
		return personTempDao.findAllOprTemp(oprId);
	}

	public OprTemp findTempByOprIdAndOrgId(OprTemp oprTemp) {
		OprTemp temp=null;
		try {
			temp=personTempDao.findTempByOprIdAndOrgId(oprTemp);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return temp;
	}

	public boolean insertOprTemp(OprTemp oprTemp) {
		boolean flag=false;
		try {
			personTempDao.insertOprTemp(oprTemp);
			flag=true;
		} catch (Exception e) {
			e.printStackTrace();
			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
			flag=false;
		}
		return flag;
	}

	public boolean updateOprTemp(OprTemp oprTemp) {
		boolean flag=false;
		try {
			personTempDao.updateOprTemp(oprTemp);
			flag=true;
		} catch (Exception e) {
			e.printStackTrace();
			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
			flag=false;
		}
		return flag;
		
	}

	public boolean deleteOprTemp(OprTemp oprTemp) {
		boolean flag=false;
		try {
			personTempDao.deleteOprTemp(oprTemp);
			flag=true;
		} catch (Exception e) {
			e.printStackTrace();
			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
			flag=false;
		}
		return flag;
		
	}

	
	
	
}
